const { DataTypes } = require('sequelize');

module.exports = (sequelize) => {
  const PrintConfig = sequelize.define('PrintConfig', {
    id: {
      type: DataTypes.BIGINT.UNSIGNED,
      primaryKey: true,
      autoIncrement: true
    },
    name: {
      type: DataTypes.STRING(100),
      allowNull: false,
      comment: '打印配置名称'
    },
    paper_type: {
      type: DataTypes.STRING(50),
      allowNull: false,
      comment: '纸张类型：普通纸、铜版纸、照片纸等'
    },
    paper_size: {
      type: DataTypes.STRING(50),
      allowNull: false,
      comment: '纸张尺寸：A4、A3、B5等'
    },
    paper_weight: {
      type: DataTypes.STRING(20),
      allowNull: true,
      comment: '纸张克重：70g、80g、100g等'
    },
    color_mode: {
      type: DataTypes.STRING(20),
      allowNull: false,
      comment: '打印模式：彩色、黑白'
    },
    duplex: {
      type: DataTypes.BOOLEAN,
      allowNull: false,
      defaultValue: false,
      comment: '是否双面打印'
    },
    price_per_page: {
      type: DataTypes.DECIMAL(10, 2),
      allowNull: false,
      comment: '每页价格'
    },
    min_pages: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: 1,
      comment: '最小打印页数'
    },
    status: {
      type: DataTypes.TINYINT,
      allowNull: false,
      defaultValue: 1,
      comment: '状态：1-启用，0-禁用'
    },
    created_at: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.NOW
    },
    updated_at: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: DataTypes.NOW
    }
  }, {
    tableName: 'print_configs',
    timestamps: true,
    createdAt: 'created_at',
    updatedAt: 'updated_at'
  });

  return PrintConfig;
};